use serde::{Deserialize, Serialize};
use validator::Validate;

#[derive(Deserialize, Serialize, Debug, Validate)]
pub struct User {
    pub id: Option<i16>,
    pub username: Option<String>,
    #[validate(length(min = 6, max = 10, message = "账号长度必须在6到10个字符之间"))]
    pub account: String,
    #[validate(required, length(min = 6, max = 16, message = "密码长度必须在6到16个字符之间"))]
    pub password: Option<String>,
    pub captcha: Option<String>
}